package com.qidi.service;

import com.qidi.bean.User;
import com.qidi.dao.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zhouXinBin
 * @create 2020-11-04-9:33
 */
@Service
public class UserService {

    @Autowired
    UserMapper userMapper;
    //注册
    public void saveUser(User user){
        userMapper.add(user);
    }

    //@return: 存在返回true  不存在返回false
    public boolean checkEixt(String username){
        User user = userMapper.getByusername(username);
        if (user==null){
            return true;
        }else {
            return false;
        }
    }
    //登录
    public User login(String usename,String password){
        return userMapper.getByUsernamePassword(usename,password);
    }
}
